package com.springcloud.demo.controller;

import com.springcloud.demo.model.Demo;
import com.springcloud.demo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by xuning on 2020/8/26.
 */
@RestController
public class DemoProviderController {

    @Autowired
    private DemoService demoService;

    @RequestMapping(value = "/helloDemoProvider")
    public Demo helloDemoProvider(@RequestBody Demo demo) {
        System.out.println("DemoFeign demoId=" + demo.getDemoId());
        System.out.println("DemoFeign demoId=" + demo.getDemoName());
        demo = demoService.helloDemoProvider(demo);
        System.out.println("DemoFeign demoId=" + demo.getDemoId());
        System.out.println("DemoFeignd emoId=" + demo.getDemoName());
        return demo;
    }

    @RequestMapping(value = "/helloDemoProviderGet")
    public Demo helloDemoProviderGet(@RequestBody Demo demo) {
        System.out.println("demoId=" + demo.getDemoId());
        System.out.println("demoId=" + demo.getDemoName());
        demo = demoService.helloDemoProvider(demo);
        System.out.println("demoId=" + demo.getDemoId());
        System.out.println("demoId=" + demo.getDemoName());
//        throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000);
        return demo;
    }
}
